'use strict';


// Declare app level module which depends on filters, and services
angular.module('myApp', [
  'ngRoute',
  'myApp.filters',
  'myApp.services',
  'myApp.servicesGame',
  'myApp.servicesUser',
  'myApp.directives',
  'myApp.controllersLogin',
  'myApp.controllersPlayer',
  'myApp.controllersGame',
  'firebase'
])
.config(['$routeProvider', function($routeProvider) {
    $routeProvider.when('/login',           {templateUrl: 'partials/login/login.html', controller: 'LoginCtrl'});
    $routeProvider.when('/logout',          {templateUrl: 'partials/login/login.html', controller: 'LogoutCtrl'}); // !!! template
    $routeProvider.when('/createaccount',   {templateUrl: 'partials/login/createaccount.html', controller: 'CreateAccountCtrl'});
    $routeProvider.when('/game/players',    {templateUrl: 'partials/player/players.html', controller: 'PlayersCtrl'});
    $routeProvider.when('/game/games',      {templateUrl: 'partials/player/games.html', controller: 'GamesCtrl'});
    $routeProvider.when('/game/play/owner', {templateUrl: 'partials/game/game.html', controller: 'PlayOwnerCtrl'});
    $routeProvider.when('/game/play/join',  {templateUrl: 'partials/game/game.html', controller: 'PlayJoinCtrl'});
    $routeProvider.when('/game/quit',       {templateUrl: 'partials/game/quit.html', controller: 'QuitCtrl'}); // !!! template
    $routeProvider.otherwise({redirectTo:   '/login'});
}])
.run(['$location', function ($location) {
    $location.path('/');
}]);
